

var nav_index = {
        200 : {
            name:"中心简介",
            category:200,
            second:[
                {name:"中心介绍",category:202},
                {name:"中心负责人",category:201},
                {name:"学术委员会",category:203},
                {name:"组织架构",category:204},
                {name:"历史沿革",category:205}
            ]
        },
        300 :{
            name:"人才队伍",
            category:300,
            second:[
                {name:"杰出人才",category:301},
                {name:"PI人员",category:302},
                {name:"研究团队",category:303},
                {name:"学生培养",category:304}
            ]
        },
        400 :{
            name:"科学研究",
            category:400,
            second:[
                {name:"研究方向",category:401},
                {name:"科研成果",category:402},
                {name:"学科建设",category:403},
                {name:"开放基金",category:404},
                {name:"科研动态",category:405}
            ]
        },
        500 :{
            name:"科研平台",
            category:500,
            second:[]
        },
        600 :{
            name:"交流动态",
            category:600,
            second:[]
        },
        700 :{
            name:"运行管理",
            category:700,
            second:[

                {name:"中心新闻",category:701},
                {name:"通知公告",category:702},
                {name:"规章制度",category:703},
                {name:"下载中心",category:704},
            ]
            
        },
        800 :{
            name :"英才招聘",
            category:800,
            second:[

                {name:"招聘信息",category:801},
                {name:"博士后招聘",category:902},
            ]
        },
        900:{
            name:"联系我们"
        },
        1000:{
            name:"学术讲座"
        }
}



$(document).ready(function(){
    if(isNaN(parseInt(category)) == false){
        replace_nav();
    }
})

function replace_nav(){
    var p = genParent(category)
    var s_index = nav_index[p].second
    var sec_nav = "";
    var title_tag = ""
    if(category == p){
        title_tag = `<h3>${nav.index[p].name}</h3>`
    }
    for(var i in s_index){
        var cu_obj =  s_index[i];
        sec_nav +=`<h3><a href="/front/route/${cu_obj.category}">${cu_obj.name}</a></h3>`;
        if(parseInt(category) == cu_obj.category){
            title_tag = `<h3>${cu_obj.name}</h3>`
        }
    }
    
    $(".Catalog em.laboratoryEm:first").html(`<span>${nav_index[p].name} </span>`)
    $(".Catalog ul.large:first").html(sec_nav)
    $(".Content div.Bread:first").html(title_tag)
}


function genParent(category){
    var i = category;
    var l = 0;
    while(i >= 10){
        i=parseInt(i/10);
        l++;
    }
   for(;l>0;l--){
    i = i*10;
   }
    return i;
}

